<?php namespace Home\Controller;

use Hdphp\Controller\Controller;



class IndexController extends Controller{

	public function index(){

		//获得最新的文章

    	$arcModel=new \Common\Model\Arc;

		$data=$arcModel

				->join('category','category_cid','=','cid')

				->where('is_recycle=0')

			   	->orderBy('sendtime','desc')

			   	->get();

		$arcTagModel = new \Common\Model\ArcTag;

		foreach ($data as $k => $v) {

			$data[$k]['tag'] = $arcTagModel

							->join('tag','tag_tid','=','tid')

							->where("article_aid={$v['aid']}")

							->get();

		}
                 foreach($data as $k=>$v){
			$x[]=$v['aid'];
		}
		View::with('x',$x);
		View::with('data',$data);
	 	View::make();   
	}

}





 ?>